<div id="slide">        
    <?=$this->action("slide-show","index","default")?>
    <script type="text/javascript" src="<?=$this->baseUrl("templates/default/")?>Scripts/jquery.nivo.slider.pack.js"></script>
    <script type="text/javascript">
    $(window).load(function() {
        $('#slider').nivoSlider();
    });
    </script>
</div>
    
<div class="block">
    <h4 class="vatlytrilieu">New Product</h4>
    <div class="block_content">
          <div class="contentWrapLeft">
                <?php foreach($this->news as $row){?>
                <div class="productWrap1">                    
                    <a title="<?=$row->name?>" class="fancybox" href="<?=$this->baseUrl("images/product/$row->image")?>">                                   
                    <?php if(!empty($row->thumb)){?>                        
                        <?php if($row->isSale){?>
                        <img class="sale-ico" src="<?=$this->baseUrl("templates/default/images/sale.gif")?>" width="50" height="50" />
                        <?php }?>
                        <img width="100" height="168" src="<?=$this->baseUrl("images/product/thumb/$row->thumb")?>" alt="<?=$row->name?>" />    
                    <?php }else{?>
                        Đang cập nhật hình.
                    <?php }?>
                    </a>
                    <div class="productNameWrap"><a href="<?=$this->baseUrl("product/$row->alias/$row->id")?>" title="<?=$row->name?>"><?=$row->name?></a></div>
                    <div class="productNamePrice">$<?=number_format($row->price,2,".","")?></div>
                    <ul><li><a class="btn addtocart" href="<?=$this->baseUrl("cart/add/$row->id-$row->alias.html")?>">• Add to Cart</a></li><li><a href="<?=$this->baseUrl("product/$row->alias/$row->id")?>" class="btn detail">• detail</a></li></ul>
                </div>
                <?php }?>
                <div class="read-more"><a href="<?=$this->baseUrl("product/list/new")?>">More...</a></div>
                <div class="clearb"></div> 
        </div>
    </div>
</div>

<div class="block">
    <h4 class="vatlytrilieu">Hot Product</h4>
    <div class="block_content">
          <div class="contentWrapLeft">    
                <?php foreach($this->hots as $row){?>
                <div class="productWrap1"> 
                    <?php if($row->isSale){?>
                    <img class="sale-ico" src="<?=$this->baseUrl("templates/default/images/sale.gif")?>" width="50" height="50" />
                    <?php }?>         
                    <a title="<?=$row->name?>" class="fancybox" href="<?=$this->baseUrl("images/product/$row->image")?>">                                   
                    <?php if(!empty($row->thumb)){?> 
                        <img width="100" height="168" src="<?=$this->baseUrl("images/product/thumb/$row->thumb")?>" alt="<?=$row->name?>" />    
                    <?php }else{?>
                        Đang cập nhật hình.
                    <?php }?>
                    </a>
                    <div class="productNameWrap"><a href="<?=$this->baseUrl("product/$row->alias/$row->id")?>" title="<?=$row->name?>"><?=$row->name?></a></div>
                    <div class="productNamePrice">$<?=number_format($row->price,2,".","")?></div>
                    <ul><li><a class="btn addtocart" href="<?=$this->baseUrl("cart/add/$row->id-$row->alias.html")?>">• Add to Cart</a></li><li><a href="<?=$this->baseUrl("product/$row->alias/$row->id")?>" class="btn detail">• detail</a></li></ul>
                </div>
                <?php }?>
                <div class="read-more"><a href="<?=$this->baseUrl("product/list/hot")?>">More...</a></div>
                <div class="clearb"></div> 
        </div>
    </div>
</div>

<div class="block">
    <h4 class="vatlytrilieu">Bargains Product</h4>
    <div class="block_content">
          <div class="contentWrapLeft">                                          
                
                <?php foreach($this->bargains as $row){?>
                <div class="productWrap1"> 
                    <?php if($row->isSale){?>
                    <img class="sale-ico" src="<?=$this->baseUrl("templates/default/images/sale.gif")?>" width="50" height="50" />
                    <?php }?>
                    <a title="<?=$row->name?>" class="fancybox" href="<?=$this->baseUrl("images/product/$row->image")?>">                                   
                    <?php if(!empty($row->thumb)){?> 
                        <img width="100" height="168" src="<?=$this->baseUrl("images/product/thumb/$row->thumb")?>" alt="<?=$row->name?>" />    
                    <?php }else{?>
                        Đang cập nhật hình.
                    <?php }?>
                    </a>
                    <div class="productNameWrap"><a href="<?=$this->baseUrl("product/$row->alias/$row->id")?>" title="<?=$row->name?>"><?=$row->name?></a></div>
                    <div class="productNamePrice">$<?=number_format($row->price,2,".","")?></div>
                    <ul><li><a class="btn addtocart" href="<?=$this->baseUrl("cart/add/$row->id-$row->alias.html")?>">• Add to Cart</a></li><li><a href="<?=$this->baseUrl("product/$row->alias/$row->id")?>" class="btn detail">• detail</a></li></ul>
                </div>
                <?php }?>
                <div class="read-more"><a href="<?=$this->baseUrl("product/list/hot")?>">More...</a></div>
                <div class="clearb"></div>
        </div>
    </div>
</div>

<script>
$(function(){
    
    $(".addtocart").click(function(){
        var link = $(this).attr("href");        
        $.get(link, null, function(rdata){
            $(".giohang a").html("<span style='color:#000;'>" + rdata + "</span>" + " item");
            window.location = "<?=$this->baseUrl("cart/")?>";
        },"json");
        
        return false;
    })
    
})
</script>